To request hit highlighting using the beforeHit and afterHit strings, provide an array of hit offsets using setHits. The array returned from the SearchResults getHits method can be used for this purpose.